//
//  AttentionTopicCell.m
//  APP_login
//
//  Created by edz on 7/20/21.
//  Copyright © 2021 baicai. All rights reserved.
//

#import "AttentionTopicCell.h"
#import "AttentionTopicModel.h"
#import "Masonry.h"

@interface AttentionTopicCell ()
@property(nonatomic,strong) UIImageView *iconView;
@property(nonatomic,strong) UILabel *topicTitleLable;
@property(nonatomic,strong) UILabel *subtitleLable;
@end


@implementation AttentionTopicCell

- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _iconView = [[UIImageView alloc] init];
        [self.contentView addSubview: _iconView];
        [_iconView mas_makeConstraints:^(MASConstraintMaker *make){
            make.top.mas_equalTo(17);
            make.left.mas_equalTo(20);
            make.size.mas_equalTo(CGSizeMake(15, 15));
        }];
        [_iconView setImage:[UIImage imageNamed:@"topic"]];
        
        _topicTitleLable = [[UILabel alloc] init];
        [self.contentView addSubview:_topicTitleLable];
        [_topicTitleLable mas_makeConstraints:^(MASConstraintMaker *make){
            make.top.mas_equalTo(10);
            make.left.mas_equalTo(50);
            make.size.mas_equalTo(CGSizeMake(300, 30));
        }];
        _topicTitleLable.font = [UIFont systemFontOfSize:20];
        
        _subtitleLable = [[UILabel alloc] init];
        [self.contentView addSubview:_subtitleLable];
        _subtitleLable.textColor = [UIColor grayColor];
        [_subtitleLable mas_makeConstraints:^(MASConstraintMaker *make){
            make.top.mas_equalTo(45);
            make.left.mas_equalTo(50);
            make.size.mas_equalTo(CGSizeMake(300, 20));
        }];
    }
    return self;
}

- (void) setModel:(AttentionTopicModel *)model{
    _topicTitleLable.text = model.name;
    _subtitleLable.text = [NSString stringWithFormat:@"%@篇日记 · %@人关注", model.feedCount, model.userCount];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
